//
// Created by Jisam on 2024/8/8 23:03.
// solve 202312-1
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        int ff = 1;
        for (int j = 0; j < n && ff == 1 ; j++) {
            int f = 1;
            if (i == j) continue;
            for (int k = 0; k < m; k++) {
                if (a[i][k] >= a[j][k]) {
                    f = 0;
                    break;
                }
            }
            if (f == 1) {
                cout << j  + 1;
                ff = 0;
            }
        }
        if (ff) cout << "0";
        if(i != n-1) cout << "\n";
    }
    return 0;
}